const Koa = require('koa');//koa2框架
const { koaBody } = require('koa-body');//解析post请求
const errHandler = require('./errHandler');//错误处理中间件
const app = new Koa();
console.log(app, 'app')

const router = require('../router/user.route');

app.use(koaBody());
app.use(router.routes());
app.use(router.allowedMethods());

// 统一错误处理
app.on('error', errHandler)

module.exports = app;